package com.atguigu.springcloud.controller;


import com.atguigu.common.CommonResult;
import com.atguigu.entity.Payment;

import com.atguigu.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-10-11
 */
@RestController
@RequestMapping("/edu/payment")
public class PaymentController {
    @Autowired
    PaymentService paymentService;
    @GetMapping("selectall")
    public CommonResult<Payment> select(){
        List<Payment> list = paymentService.list();
        return new CommonResult(200,list);
    }
    @GetMapping("selectById/{id}")
    public CommonResult<Payment> selectById(@PathVariable Long id){
        Payment payment = paymentService.getById(id);
        return new CommonResult(200,payment);

    }



}

